libxl: fix dom0 minimum memory threshold check
authorGianni Tedesco <gianni.tedesco@citrix.com>
Thu, 28 Oct 2010 11:02:22 +0000 (12:02 +0100)
committerGianni Tedesco <gianni.tedesco@citrix.com>
Thu, 28 Oct 2010 11:02:22 +0000 (12:02 +0100)
commit1e346e3f47660883cf7618b8a62831b04b81ddce
tree06fec9f7613eacc7947363ecc30912565c6e6a0f
parent576b10f44cf9dfaf0600b6216659cbda25825d98
libxl: fix dom0 minimum memory threshold check

libxl_set_memory_target tries to set the memory target for a given
domain to new_target_memkb. The function includes a check to make sure
that dom0's memory is not reduced below a minimal threshold ie.
LIBXL_MIN_DOM0_MEM. However, this check is performed before the
new_target_memkb variable is properly initialised - when the value is
always zero. This means that the check always fails. Fix this by moving
the test to happen after the proper initialisation of new_target_memkb.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl.c